#pragma once
#include "Dllexport.h"
#include <string>
#include "Exception.h"
namespace NBGUI
{
	struct GUIAPI Texture
	{
		Texture(unsigned int w, unsigned int h):
			width(w),height(h)
		{}

		Texture(const wchar_t* _path, unsigned int w = 0, unsigned int h = 0 ):
			path(_path),width(w),height(h),pTex(nullptr)
		{}

		Texture(const char* _path, unsigned int w = 0, unsigned int h = 0 ):
			width(w),height(h),pTex(nullptr)
		{
			//cast to wchar
			int len = strlen(_path) + 1;//'\0'
			if (len > 512)
			{
				throw GUIException(ImagePathTooLong,L"Image path too long.");
			}
			wchar_t* strWchar = new wchar_t[512];
			int w_Len = MultiByteToWideChar(CP_ACP, 0, _path, len, strWchar, 512);
		    path = std::wstring(strWchar);
			delete strWchar;
		}
		
		~Texture()
		{}

		void* pTex;//pointer to the specific renderer texture type.
		unsigned int width;
		unsigned int height;
		std::wstring path;
	};
}